package com.holyn.guofang.presenter.login;

import android.app.Activity;
import android.net.Uri;

import com.holyn.guofang.model.webhttp.wo.UpdateInfoWo;
import com.holyn.guofang.model.webhttp.wo.UserInfoWo;
import com.holyn.guofang.presenter.AbstractBasePresenterImp;
import com.holyn.guofang.presenter.BasePresenter;
import com.holyn.guofang.presenter.BaseView;

import java.io.File;
import java.util.List;

import zlc.season.rxdownload2.entity.DownloadStatus;

/**
 * Created by Holyn on 2017/4/26.
 */

public class LoginContract{
    /**
     * post../get../upload../download../......对应web服务器的交互
     *
     * query../insert../......对应数据库操作
     */
    public static abstract class
    Presenter extends AbstractBasePresenterImp {

        public Presenter(BaseView baseView) {
            super(baseView);
        }

        public abstract void addViewListener(LoginContract.View view);
        public abstract void addUserInfoWoViewListener(LoginContract.UserInfoWoView view);

        public abstract void postLogin(String userName, String password, int requestAction);
        public abstract void postLoginB(String userName, String validCode, int requestAction);

        public abstract void postLoginCheck(String userName, String validCode, int requestAction);
        public abstract void postPlatformUpdate(int requestAction);
        public abstract void downloadNewApp(Activity activity, UpdateInfoWo updateInfoWo, int requestAction);

        public abstract void postUploadTest(List<File> files);
    }

    /**
     * 把一切都规范为 request／response 开头
     */
    public interface View {
        void responseSuccess(Integer requestAction, UserInfoWo userInfoWo);
        void responseSuccessGetUpdateInfoWo(Integer requestAction, UpdateInfoWo updateInfoWo);

        void responseDownloadNewAppStatus(Integer requestAction, DownloadStatus downloadStatus);
        void responseDownloadNewAppComplete(Integer requestAction, Uri uri);
    }

    public interface UserInfoWoView {
        void responseSuccess(Integer requestAction, UserInfoWo userInfoWo);
    }
}
